package com.winhxd.b2c.admin.module.order.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.winhxd.b2c.admin.common.security.annotation.CheckPermission;
import com.winhxd.b2c.common.constant.BusinessCode;
import com.winhxd.b2c.common.domain.PagedList;
import com.winhxd.b2c.common.domain.ResponseResult;
import com.winhxd.b2c.common.domain.order.condition.OrderUserManagementQueryCondition;
import com.winhxd.b2c.common.domain.order.vo.OrderInfoDetail4UserManagementVO;
import com.winhxd.b2c.common.domain.system.security.enums.PermissionEnum;
import com.winhxd.b2c.common.feign.order.OrderUserManagementClient;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;

/**
 * 
 * @author suhaochan
 * @date 2019/1/11 16:11:31
 */
@RestController
@Api(value = "后台用户管理订单相关接口", tags = "后台用户管理订单相关接口")
@RequestMapping("/order")
public class OrderUserManagementController {

    @Resource
    private OrderUserManagementClient orderUserManagementClient;

    @CheckPermission(PermissionEnum.DISTRIBUTOR_DETAIL_DIS_ORDER)
    @ApiOperation(value = "查询分销商订单列表", notes = "查询分销商订单列表")
    @PostMapping(value = "/findDistributorOrder")
    @ApiResponses({@ApiResponse(code = BusinessCode.CODE_OK, message = "操作成功"), @ApiResponse(code = BusinessCode.CODE_1001, message = "服务器内部错误")})
    public ResponseResult<PagedList<OrderInfoDetail4UserManagementVO>> findDistributorOrder(@RequestBody OrderUserManagementQueryCondition condition) {
    	ResponseResult<PagedList<OrderInfoDetail4UserManagementVO>> responseResult = orderUserManagementClient.findDistributorOrder(condition);
        return responseResult;
    }

    @CheckPermission(PermissionEnum.DISTRIBUTOR_DETAIL_DIS_MEMBER_ORDER)
    @ApiOperation(value = "查询分销商会员订单列表", notes = "查询分销商会员订单列表")
    @PostMapping(value = "/findDistributorMemberOrder")
    @ApiResponses({@ApiResponse(code = BusinessCode.CODE_OK, message = "操作成功"), @ApiResponse(code = BusinessCode.CODE_1001, message = "服务器内部错误")})
    public ResponseResult<PagedList<OrderInfoDetail4UserManagementVO>> findDistributorMemberOrder(@RequestBody OrderUserManagementQueryCondition condition) {
    	ResponseResult<PagedList<OrderInfoDetail4UserManagementVO>> responseResult = orderUserManagementClient.findDistributorMemberOrder(condition);
        return responseResult;
    }

    @CheckPermission(PermissionEnum.CUSTOMER_MANAGEMENT_ORDER_DETAIL)
    @ApiOperation(value = "查询会员订单列表", notes = "查询会员订单列表")
    @PostMapping(value = "/findMemberOrder")
    @ApiResponses({@ApiResponse(code = BusinessCode.CODE_OK, message = "操作成功"), @ApiResponse(code = BusinessCode.CODE_1001, message = "服务器内部错误")})
    public ResponseResult<PagedList<OrderInfoDetail4UserManagementVO>> findMemberOrder(@RequestBody OrderUserManagementQueryCondition condition) {
    	ResponseResult<PagedList<OrderInfoDetail4UserManagementVO>> responseResult = orderUserManagementClient.findMemberOrder(condition);
        return responseResult;
    }
    
}
